<%@ page language="java" pageEncoding="UTF-8" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<%@ include file="/commons/jsp/taglibs.jsp" %>
<%@taglib prefix="frame" uri="http://www.framework.com/taglib" %>
<html>
<head>
    <title>公共平台 </title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <!-- 样式文件的引入 -->
    <link href="${ctx}/commons/css/style.css" rel="stylesheet" type="text/css"/>
    <link rel="stylesheet" type="text/css" href="${ctx}/commons/themes/default/easyui.css"/>
    <link rel="stylesheet" type="text/css" href="${ctx}/commons/themes/icon.css"/>
    <!-- jqueryUI JS文件的引入 -->
    <script type="text/javascript" src="${ctx}/commons/js/jquery-1.8.0.min.js"></script>
    <script type="text/javascript" src="${ctx}/commons/js/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="${ctx}/commons/js/easyui-extends-validate.js"></script>
    <!-- jqueryUI国际化 -->
    <script type="text/javascript" src="${ctx}/commons/js/easyui-lang-zh_CN.js"></script>
    <!-- 开发使用的公用js方法 -->
    <script type="text/javascript" src="${ctx}/commons/js/common.js"></script>
    <!-- 开发国际化的引用，主要完成后台信息在前台提示的国际化，一定要放在最后 -->
    <script type="text/javascript">var ctx = '${ctx}';
    var actionExt = "action";
    var i18n = new Object();</script>
    <script src="${ctx}/commons/js/i18n/message_zh_CN.js" type="text/javascript"></script>
</head>

<body>
<div class="easyui-layout" data-options="fit:true,border:false">
    <div data-options="region:'center',border:true">
        <div class="easyui-layout" data-options="fit:true,border:false">
            <div data-options="region:'north',border:false" style="padding: 4px;height: 50px;overflow: hidden;">
                <div class="easyui-panel" data-options="fit:true,border:true">
                    <div class="queryContent">
                        <form name="searchForm" id="searchUserForm" method="post" action="" style="display: none; ">
                            <table class="queryTable">
                                <tbody>
                                <tr>
                                    <th width="70%">项目名称</th>
                                    <td><input class="easyui-validatebox" type="text" name="name" maxlength="20"
                                               style="width:120px"></input></td>
                                    <td align="left"><a href="javascript:void(0);" class="easyui-linkbutton"
                                                        id="searchUser" plain="true">查询</a>
                                        <a href="javascript:void(0);" class="easyui-linkbutton" id="resetSearchUser"
                                           plain="true">清空</a></td>
                                </tr>
                                </tbody>
                            </table>
                        </form>
                    </div>
                </div>
            </div>
            <div data-options="region:'center',border:false" style="padding: 4px;">
                <table id="listUserTable" class="easyui-datagrid"
                       data-options="singleSelect:false,toolbar:'#usertb',method:'post',rownumbers:true,fit:true,fitColumns:true,border:true,
					pagination:true,remoteSort:true,multiSort:true,striped:true,onLoadSuccess:function(data){$('#'+userParamObj.searchID).attr('disabled',false);},
					url:'${ctx}/auction/business/regAudit/list'" }>
                    <thead>
                    <tr>

                        <th data-options="field:'auctionName',width:40,title:'项目名称'"></th>
                        <th data-options="field:'operate',width:100,align:'center',title:'操作',formatter:
                        function(value,row,index){
                         return '<a href=javascript:void(0); onclick=signProject(\'' + row.id + '\') >报名</a>';
                       }"></th>
                    </tr>
                    </thead>
                </table>
            </div>
        </div>
    </div>
</div>
</body>
<script type="text/javascript">
    //初始化表格对应的js对象
    var userParamObj;
    $(function () {
        //初始化表格对象数据
        userParamObj = new initParams(
            {
                paramObjName: 'userParamObj',//表格对应的实体对象名称，好区分多个表格情况下的对象
                tableId: 'listUserTable',
                addDataFormId: 'addUserDataForm',
                showDialogId: 'firstLevelDialog',
                searchID: 'searchUser',
                resetSearchID: 'resetSearchUser',
                searchFormID: 'searchUserForm',
                updateUrl: "${ctx}/framework/user/input?id=",
                deleteUrl: '${ctx}/framework/user/remove',
                addDialogWidth: 700,
                addDialogHeight: 330,
                ctx: '${ctx}',
                addDialogTitle: '用户信息'
            });
        //初始化查询
        init(userParamObj);
    });
    function signProject(id) {
        top.$('#firstLevelDialog').dialog({
            title: "报名",
            iconCls: 'icon-role-menu',
            width: 450,
            height: 300,
            closed: false,
            inline: true,
            cache: false,
            href: "${ctx}/auction/business/regAudit/uploadPage?id="+id,
            modal: true,
            buttons: [{
                text: '提交',
                id: 'saveEntityBt',
                iconCls: 'icon-ok',
                handler: function () {
                    var uploadify = top.$("#uploadify").val();
//                    if (uploadify == "") {
//                        top.$.messager.alert('提示', "请选择上传报名材料！", 'info');
//                    } else {
                        $.ajax({
                            type: "POST",
                            timeout: 20000,
                            url: "${ctx}/auction/business/regAudit/save",
                            data: top.$('#signForm').serialize(),
                            success: function (data) {
                                if(data=="success"){
                                    top.$.messager.alert('提示', '提交成功', 'success',function(){
                                        $('#listProjectsTable').datagrid('reload');
                                        top.$('#firstLevelDialog').dialog('close');
                                    });
                                }

                            },
                            error: function () {
                                top.$.messager.alert('提示', i18n.requestError, 'error');
                            }
                        });
//                    }
                }
            }, {
                text: '取消',
                iconCls: 'icon-cancel',
                handler: function () {
                    top.$('#firstLevelDialog').dialog('close');
                }
            }]
        }).dialog('open');
    }
    function getCheckValues(input_name) {
        var values = "";
        top.$("input:checkbox[name='" + input_name + "']:checked").each(function (i) {
            if (0 == i) {
                values = $(this).val();
            } else {
                values += ("," + $(this).val());
            }
        });
        return values;
    }
</script>
</body>
</html>